<!DOCTYPE html>
<html>
<head>
    <title>电影列表</title>
    <style>
        .movie-container {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            margin-bottom: 20px;
        }
        .movie-card {
            border: 1px solid #ddd;
            padding: 15px;
            width: 300px;
            border-radius: 5px;
        }
        .pagination {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-top: 20px;
        }
        .pagination form {
            display: inline;
        }
    </style>
</head>
<body>
    <h1>电影列表</h1>
    
    <div class="movie-container">
        {% for movie in movies %}
        <div class="movie-card">
            <h2>{{ movie.title }} ({{ movie.year }})</h2>
            <p><strong>导演:</strong> {{ movie.director }}</p>
            <p>{{ movie.description }}</p>
        </div>
        {% endfor %}
    </div>
    
    <div class="pagination">
        {% if current_page > 1 %}
        <form method="post">
            {% csrf_token %}
            <input type="hidden" name="current_page" value="{{ current_page|add:-1 }}">
            <button type="submit">上一页</button>
        </form>
        {% endif %}
        
        <span>第 {{ current_page }} 页 / 共 {{ total_pages }} 页</span>
        
        {% if current_page < total_pages %}
        <form method="post">
            {% csrf_token %}
            <input type="hidden" name="current_page" value="{{ current_page|add:1 }}">
            <button type="submit">下一页</button>
        </form>
        {% endif %}
    </div>
</body>
</html>
